package com.sfeir.gwt.webding.client.showcase;

import com.google.gwt.user.client.ui.FormPanel;
import com.google.gwt.user.client.ui.Widget;
import com.google.gwt.user.client.ui.FormPanel.SubmitEvent;
import com.sfeir.gwt.webding.client.component.Info;
import com.sfeir.gwt.webding.client.component.label.LabelForm;
import com.sfeir.gwt.webding.client.component.label.LabelTextBox;
import com.sfeir.gwt.webding.client.showcase.ShowcaseAnnotations.ShowcaseSource;


public class TabForm extends LazyTab {

    /**
     * 
     */
    @Override
    @ShowcaseSource
    protected Widget createTab() {
        final LabelForm panel = new LabelForm();

        panel.add(new LabelTextBox("Champs 1"));

        panel.add(new LabelTextBox("Champs 2", true));

        panel.addSubmitButton("Envoyer");
        panel.addResetButton("Réinitialiser");
        panel.addValidateButton("Valider");
        panel.addButton("Un bouton");
        panel.addSubmitHandler(new FormPanel.SubmitHandler() {

            public void onSubmit(SubmitEvent event) {
                Info.display("Submit : " + panel.getValues());
            }

        });
        
        return panel;
    }

    @Override
    public String getDescription() {
        return "Panel contenant une liste d'élèment de formulaire de type LabelComponent";
    }

    @Override
    public String getName() {
        return "Formulaire";
    }

}